package com.sale.system.controller;

import com.sale.common.core.domain.R;
import com.sale.common.core.web.controller.BaseController;
import com.sale.common.log.annotation.Log;
import com.sale.common.log.enums.BusinessType;
import com.sale.system.domain.dto.SysWorkbenchDto;
import com.sale.system.domain.vo.SysWorkbenchVo;
import com.sale.system.service.SysWorkbenchService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 快捷功能控制层
 */
@RestController
@RequestMapping("/sys-workbench")
public class SysWorkbenchController extends BaseController {

    @Resource
    SysWorkbenchService sysWorkbenchService;


    /**
     * 获取登录用户快捷功能列表
     */
//    @RequiresPermissions("system:workbench:list")
    @GetMapping("/list")
    public R<List<SysWorkbenchDto>> list(SysWorkbenchVo sysWorkbenchVo) {
        return R.ok(sysWorkbenchService.getList(sysWorkbenchVo));
    }

    /**
     * 用户快捷功能新增/修改
     */
//    @RequiresPermissions("system:workbench:addOrUpdate")
    @Log(title = "用户快捷功能新增", businessType = BusinessType.INSERT)
    @PostMapping("/addOrUpdate")
    public R<Void> add(@RequestBody SysWorkbenchVo sysWorkbenchVo) {
        return toAjax(sysWorkbenchService.addOrUpdate(sysWorkbenchVo));
    }


}
